/*
 * @file vcddeck.c Main program entrypoint.
 *
 * @Copyright (C) 2007 Kris Marsh.
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the
 * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
 * Boston, MA  02110-1301, USA.
 */

#include "vcddeck.h"

gint
main (gint argc,
	gchar *argv[])
{
	gst_init(&argc, &argv);

	if (argc > 1) {
		/* Quickly check whether command line includes --help, -h or -? and print some help if so. */
		if (!strcmp(argv[1], "--help") || !strcmp(argv[1], "-h") || !strcmp(argv[1], "-?")) {
			g_print ("Virtual CD Deck\n");
			g_print ("Usage: %s <URI> [Sound card]\n", argv[0]);
			return 0;
		}

		/* Check for (optional) sound card. */
		if (argc > 2 && argv[2]) {
			gst_set_soundcard(argv[2]);
		}

		/* Check for command line URI and load. */
		g_debug("URI '%s' found on command line", argv[1]);
		if (gst_load_uri(argv[1]) == FALSE) {
			g_print("Could not load URI\n");
			return -1;
		}
	}

	/* Used to test that GStreamer is working ok. */
	/* g_assert(gst_play() == TRUE); */

	/* Set up and show GUI. */
	gtk_init(&argc, &argv);;
	gui_init();
	gui_show();

	return 0;
}
